#!/bin/bash

echo "Running pre-push checks..."

# Check formatting
echo "Checking formatting..."
if ! cargo fmt -- --check; then
    echo "❌ Formatting check failed. Please run 'cargo fmt' to fix formatting issues."
    exit 1
fi

# Run clippy
echo "Running clippy..."
if ! cargo clippy -- -D warnings; then
    echo "❌ Clippy check failed. Please fix the warnings before committing."
    exit 1
fi

# Check documentation
echo "Checking documentation..."
if ! RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --document-private-items --all-features; then
    echo "❌ Documentation check failed. Please fix documentation issues."
    exit 1
fi

echo "✅ All checks passed!"
exit 0 
 